package org.promote.hotspot.common.model;

import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import org.promote.hotspot.common.tool.Constant;
import org.promote.hotspot.common.tool.FastJsonUtils;

/**
 * @author enping.jep
 * @date 2024/02/21 10:31
 **/
public class MsgBuilder {

    public static ByteBuf buildByteBuf(String msg) {
        return Unpooled.copiedBuffer((msg + Constant.DELIMITER).getBytes());
    }

    public static ByteBuf buildByteBuf(HotSpotMsg hotSpotMsg) {
        return Unpooled.copiedBuffer((FastJsonUtils.convertObjectToJSON(hotSpotMsg) + Constant.DELIMITER).getBytes());
    }
}
